package com.wyw.hemerocallis.feign;

import com.wyw.hemerocallis.vo.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * Sentinel 对 OpenFeign 接口的降级策略
 *
 * @author Mr Wu    yewen.wu.china@gmail.com
 * <p>
 * Update History:
 * Author        Time            Content
 */
@Slf4j
@Component
public class SentinelFeignClientFallback implements SentinelFeignClient {

    @Override
    public CommonResponse<String> getResultByFeign(String code) {
        log.error("request supply for test has some error: [{}]", code);
        return new CommonResponse<>(
                "4000",
                "sentinel feign fallback",
                "input code: "+ code
        );
    }
}
